/**
 *  form style
 *  prepended and appended input 不要换行，设置font-size;0 ie低版本需要float解决其他bug
 */
// default form style is inline
.form {
  fieldset {
    border: 0;
  }

  legend {
    padding: 0.3em 0;
    margin-bottom: 1em;
    width: 100%;
    font-size: 1.25em;
    line-height: 2em;
    border-bottom: 1px solid @borderColor;

    *margin-left: -7px;
    *zoom: 1;
  }
}

.input, .textarea {
  width: 170px;
}
.select {
  width: 170px + 12px; // width bug
}

// 按钮不能太大，否则ie需要双击触发
.input-file-container {
  .inline-block();
  position:relative;
  cursor:pointer;
  overflow:hidden;
  vertical-align:middle;
  _padding-bottom: 1px; // ie6 被挡住一个像素bug

  .input-file {
    position:absolute;
    right:0;
    top:0;
    _font-size:100px; /* overwrite*/
    _font-size:12px;
    _zoom:10; /* overwrite */
    height:100%;
    _height:auto;
    opacity:0;
    filter:alpha(opacity=0);
    cursor:pointer;
  }
}

// input size
.input, .textarea {
  &-smaller {
    width: 60px;
  }
  &-small {
    width: 100px;
  }
  &-large {
    width: 280px;
  }
  &-larger {
    width: 460px;
  }
}

.select { // width bug
  &-smaller {
    width: 60px + 12px;
  }
  &-small {
    width: 100px + 12px;
  }
  &-large {
    width: 280px + 12px;
  }
  &-larger {
    width: 460px + 12px;
  }
}

.input, .select, .textarea {
  padding: @componentPadding 6px;
  border: 1px solid @formBorderColor;
  &:focus {
    outline: 0;
  }
}
.input {
  height: @baseLineHeight;
}

.input, .textarea {
  &:focus {
    border-color: @formFocusBorderColor;
  }
}

.input-success {
  border: 1px solid @borderSuccessColor;
  &:focus {
    border-color: darken(@borderSuccessColor, 10%);
  }
}
.input-info {
  border: 1px solid @borderInfoColor;
  &:focus {
    border-color: darken(@borderInfoColor, 10%);
  }
}
.input-warn {
  border: 1px solid @borderWarnColor;
  &:focus {
    border-color: darken(@borderWarnColor, 10%);
  }
}
.input-error {
  border: 1px solid @borderErrorColor;
  &:focus {
    border-color: darken(@borderErrorColor, 10%);
  }
}

.checkbox, .radio {
  .inline-block();
  padding-top: 5px;
}

.input-disabled, .textarea-disabled{
  background-color: #f2f2f2;
}

.form-required {
  color: #f00;
  font-family: SimSun;
  font-size: 14px;
  line-height: @baseFontSize * @baseLineHeight;
}

// .form-explain see .text-inverse
// .form-text-xxx see .text-xxx

// item
.form-item {
  margin-bottom: @baseFormSpace * 2;
  .clearfix();
}
// style group
.form-item-group{
  margin-bottom: @baseFormSpace * 2;
  .form-item {
    margin-bottom: 0;
    margin-top: -1px;
    *zoom:1;

    .input {
      *float: left;
      position: relative;
      &:focus {
        z-index: 2;
      }
    }
  }
}

// y space, default one line-height
.form-space-small {
  .form-item {
    margin-bottom: @baseFormSpace;
  }

  .form-item-group {
    margin-bottom: @baseFormSpace;
  }
}
.form-space-large {
  .form-item {
    margin-bottom: @baseFormSpace * 3;
  }

  .form-item-group {
    margin-bottom: @baseFormSpace * 3;
  }
}

// style stacked
.form-stacked {
  .label {
    display: block;
    margin-bottom: .2em;
  }
}

// style aligned
.form-aligned {
  .form-item {
    padding-left: 160px;
  }

  .label {
    float: left;
    padding-top: 5px;
    margin-left: -160px;
    width: 150px;
    text-align: right;
  }
}

.input-add-on,{
  // font-size: 0; // white space collapse hack
  white-space: nowrap; // Prevent span and input from separating

  .add-on {
    .inline-block();
    vertical-align: middle;
    font-size: @baseFontSize;
    height: @baseLineHeight;
    line-height: @baseLineHeight;
    padding: @componentPadding @componentPadding + 1;
    background-color: @grayLighter;
    border: 1px solid @formBorderColor;
    position: relative;
    z-index: 2;
  }
  .input:focus {
    position: relative;
    z-index: 3;
  }
  .btn{
    height: @baseLineHeight;
    line-height: @baseLineHeight;
    position: relative;
    z-index: 2;
  }
  .add-on-p {
    margin-right: -1px;
  }
  .add-on-a {
    margin-left: -1px;
  }
}